<template>
  <div>
    <!-- 新建地址 -->
    <div class="ttop">
      <van-nav-bar  title="乐购" left-text="返回" left-arrow @click-left="onClickLeft" />
    </div>
    <div class="main">
      <div class="list" v-for="item in list" :key="item.id">
        <div class="name">{{item.name}}</div>
        <div class="info">
          <p>{{item.mobile}}</p>
          <p>{{item.address}} {{item.address_detail}}</p>
        </div>
        <router-link tag="div" class="img" to="/my/newcreate">
        <!-- <div class="img"> -->
        </router-link>
      </div>
      <router-link to="/my/newcreate" class="bottom">
        <div class="bottoms">+ 新建地址</div>
      </router-link>
    </div>
  </div>
</template>

<script>

import { getListAction } from "@/api/my/address.js";
export default {
  data() {
    return {
      list: [],
      show: false
    };
  },
  methods: {
    onClickLeft() {
      this.$router.go(-1);
    }
  },
  created() {
    var openId = localStorage.getItem("openId");
    getListAction({
      openId: openId,
    }).then((res) => {
      this.list= res.data;
    });
  },
};
</script>

<style lang="scss" scoped>

.ttop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  // height: 46px;
  z-index: 666;
}
.main {
  padding-top:50px;
  // padding-bottom: 50px;
  width: 100%;
  .list {
    border: 2px solid  #f4f4f4;
    width: 96%;
    // height: 100px;
    height: 66px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    .info{
        width: 50%;
        text-align: left;
        p:nth-child(1){
          font-size: 12px;
        }
        p:nth-child(2){
          font-size: 12px;
          color: #666;
        }
    }
    .img {
      width: 25px;
      height: 25px;
      background: url(../../../assets/edit.png) no-repeat;
      background-size: 100% 100%;
    }
  }
}
.bottom {
  width: 100%;
  background-color: #fff;
  position: fixed;
  bottom: 0;
  left: 0;
  z-index: 999;
  overflow: hidden;
  .bottoms {
    width: 90%;
    margin: 0 auto;
    height: 0.93333rem;
    line-height: 0.93333rem;
    text-align: center;
    border: 1px solid #b4282d;
    color: #b4282d;
    margin: 15px auto;
  }
}

</style>